package com.xiaozhuai.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class IpController {

    @ResponseBody
    @RequestMapping("/ip")
    public String getIp(HttpServletRequest req){
        String ip;
        System.out.println(ip = req.getRemoteAddr());
        return ip;
    }
}
